package com.letoken.platform.repo.app.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.letoken.platform.repo.app.po.AppFundDetail;
import com.letoken.platform.repo.app.po.AppMiningDetail;
import com.letoken.platform.repo.app.req.user.MiningDetailReq;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 作者
 * @since 2023-10-16
 */
public interface AppMiningDetailMapper extends BaseMapper<AppMiningDetail> {
    @Select("select IFNULL(amount,0) from app_mining_detail where create_time BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND CURDATE() and type = 2 and user_id=#{userId} limit 1")
   BigDecimal getYesterdayIncome(@Param("userId")Integer userId);

    Page<AppMiningDetail> getMiningDetail(@Param("userId")Integer userId, @Param("page") Page<AppMiningDetail> page,@Param("type")Integer type);
}
